package com.meida.module.bus.client.enums;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.NoArgsConstructor;

/**
 * 订单支付状态
 *
 * @author gp
 * @date 2021/8/9
 */
@NoArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@ApiModel("订单支付状态")
public enum PayStateEnum {
    /**
     * 订单支付状态(0:未支付,1:已支付,2已退款)
     */
    NoPay(0, "未支付"),
    HavePay(1, "已支付"),
    refund(2, "已退款");

    @EnumValue
    private Integer value;

    private String label;

    PayStateEnum(Integer value, String label) {
        this.value = value;
        this.label = label;
    }


    public void setValue(Integer value) {
        this.value = value;
    }

    public Integer getValue() {
        return value;
    }


    public static PayStateEnum getByValue(Integer value) {
        for (PayStateEnum payStateEnum : values()) {
            if (payStateEnum.getValue() == value) {
                return payStateEnum;
            }
        }
        return null;
    }
}
